package com.originalpoint.origin_server.service.Impl;


import com.originalpoint.origin_server.mapper.AdminMapper;
import com.originalpoint.origin_server.pojo.Admin;
import com.originalpoint.origin_server.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 *@作者:lhj
 *Service实现类
 *@Date:2023/07/02
*/
@Service
public class AdminServiceImpl implements AdminService {


	@Resource
	private AdminMapper admindao;


	/**
	根据AdminId查询
	*/
	public Object selectByAdminId(Integer adminId){
		return admindao.selectByAdminId(adminId);
	}


	/**
	根据AdminId更新
	*/
	public Integer updateByAdminId(Admin demo){
		return admindao.updateByAdminId( demo);
	}



	/**
	根据AdminId删除
	*/
	public Integer deleteByAdminId(Integer adminId){
		return admindao.deleteByAdminId(adminId);
	}





	/**
	 insert:(插入)
	*/
	public Object insert(Admin demo){
		admindao.insert(demo);
		return demo;
	}



	/**
	 insertOrUpdate(插入或更新(根据主键或唯一索引更新，主键和唯一索引不会改变))
	*/
	public Integer insertOrUpdate(Admin demo){
		return admindao.insertOrUpdate(demo);
	}



	/**
	 insertBath:(批量插入)
	*/
	public Integer insertBatch(List<Admin> list){
		return admindao.insertBatch(list);
	}



	/**
	 insertOrUpdateBatch:(批量插入或更新)
	*/
	public Integer insertOrUpdateBatch(List<Admin> list){
		return admindao.insertOrUpdateBatch(list);
	}



	/**
	 selectList:(根据参数查询集合)
	*/
	public List<Admin> selectList(Map<String,Object> param){
		int start = Integer.parseInt(param.get("pageSize").toString()) * (Integer.parseInt(param.get("pageNum").toString()) - 1);
		param.put("pageNum",start);
		return admindao.selectList(param);
	}



	/**
	 selectCount:(根据集合查询数量)
	*/
	public Long selectCount(Map<String,Object> param){
		return admindao.selectCount(param);
	}



}